package com.hms.service.impl;

import java.io.Serializable;
import java.util.List;

import com.hms.common.Pager;
import com.hms.service.IBaseService;

/**
 * 基础业务实现接口. <br>
 * 类详细说明.
 * <p>
 * Copyright: Copyright (c) 2013-3-29 下午3:20:59
 * <p>
 * Company: 北京宽连十方数字技术有限公司
 * <p>
 * 
 * @author wangpz@c-platform.com
 * @version 1.0.0
 */
// @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public abstract class BaseService<T, PK extends Serializable> implements IBaseService<T, PK> {

	@Override
	public T get(PK id) {
		return getDao().get(id);
	}

	@Override
	public T load(PK id) {
		return getDao().load(id);
	}

	@Override
	public List<T> getAll() {
		return getDao().getAll();
	}

	@Override
	public T get(String propertyName, Object value) {
		return getDao().get(propertyName, value);
	}

	@Override
	public List<T> get(PK[] ids) {
		return getDao().get(ids);
	}

	@Override
	public List<T> getAll(String propertyName, Object value) {
		return null;
	}

	@Override
	// @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
	public void delete(PK id) {
		getDao().delete(id);
	}

	@Override
	// @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
	public void delete(PK[] ids) {
		getDao().delete(ids);
	}

	@Override
	public Long getTotalCount() {
		return getDao().getTotalCount();
	}

	@Override
	// @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
	public PK save(T entity) {
		return getDao().save(entity);
	}

	@Override
	// @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
	public void update(T entity) {
		getDao().update(entity);
	}

	@Override
	// @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
	public void delete(T entity) {
		getDao().delete(entity);
	}

	@Override
	public void fulsh() {
		getDao().flush();

	}

	@Override
	public void clear() {
		getDao().clear();
	}

	@Override
	public void evict(Object object) {
		getDao().evict(object);
	}

	@Override
	public Pager<T> findByPager(Pager<T> pager) {
		return getDao().findByPager(pager);
	}

	@Override
	public Boolean isExist(String propertyName, Object value) {
		return getDao().isExist(propertyName, value);
	}

	@Override
	public Boolean isUnique(String propertyName, Object oldValue, Object newValue) {
		return getDao().isUnique(propertyName, oldValue, newValue);
	}

}
